package org.cloud.feign.service;

import org.cloud.entity.LoginUserDetails;
import org.cloud.feign.config.FeignTracerConfiguration;
import org.cloud.vo.FrameUserRefVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@Lazy
@FeignClient(name = "${spring.application.group:}COMMON-SERVICE", contextId = "onCommonService", configuration = {
    FeignTracerConfiguration.class})  // 不区分大小写
public interface ICommonServiceFeignClient {

    @PostMapping(value = "/inner/userinfo/addUserRef", consumes = MediaType.APPLICATION_JSON_VALUE)
    Integer addUserRef(@RequestBody FrameUserRefVO frameUserRefVO);

    @PutMapping(value = "/inner/userinfo/updateUserRef", consumes = MediaType.APPLICATION_JSON_VALUE)
    Integer updateUserRef(@RequestBody FrameUserRefVO frameUserRefVO);

    @GetMapping(value = "/inner/userinfo/getCurrentUserRefByAttributeName")
    FrameUserRefVO getCurrentUserRefByAttributeName(@RequestParam("name") String attributeName);

    @GetMapping("/inner/userinfo/getUserRefByAttributeName/{userId}")
    FrameUserRefVO getUserRefByAttributeName(@PathVariable("userId") Long userId, @RequestParam("name") String attributeName);

    @GetMapping("/inner/userinfo/getUserByUserName")
    LoginUserDetails getUserByUserName(@RequestParam("userName") String userName);

    @PostMapping(value = "/inner/user/disabledUser/{username}/{userType}")
    String disabledUser(@PathVariable("username") String username, @PathVariable("userType") String userType);

    @GetMapping(value = "/disabledUser/{userId}")
     String disabledUser(@PathVariable("userId") Long userId) ;

    @PostMapping(value = "/inner/user/enabledUser/{username}/{userType}")
    String enabledUser(@PathVariable("username") String username, @PathVariable("userType") String userType);

    @GetMapping(value = "/inner/enabledUser/{userId}")
    String enabledUser(@PathVariable("userId") Long userId);

    @PostMapping(value = "/inner/tel/send/msg")
    int sendTelMsg(@RequestParam("chatId") final String chatId, @RequestParam("message") final String message,
        @RequestParam("parseMode") String parseMode);
}
